﻿<%--<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<CRM.Models.TrainingsSchedules>" %>--%>
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<CRM.Database.Model.TrainingsSchedules>" %>


<%
    var coursesCol = new CRM.Database.Model.TrainingsCoursesCollection();
%>

<% 
if(!(Model.IdTrainingsSchedule > 0))
{
    Html.DevExpress().ComboBox(settings =>
    {
        settings.Name = "IdTrainingsCource";
        settings.CallbackRouteValues = new { Controller = "TC", Action = "TrainingsSchedulesEditCoursesPartial" };
        settings.Properties.ValueType = typeof(int);
        settings.Properties.TextField = "Name";
        settings.Width = 604;
        settings.Properties.ValueField = "IdTrainingsCourse";
        settings.Properties.EnableCallbackMode = true;
        settings.Properties.ClientSideEvents.SelectedIndexChanged = "function(s, e) { IdTrainingsTrainer.PerformCallback();  }";
    }).BindList(coursesCol.FullDefinedCourses.OrderBy(p => p.Name)).Bind(Model.IdTrainingsCource).GetHtml();
    //}).BindList(DB.GetFullDefinedCourses().OrderBy(p=> p.Name)).Bind(Model.IdTrainingsCource).GetHtml();
}
if ((Model.IdTrainingsSchedule > 0))
{
    Html.DevExpress().ComboBox(settings =>
    {
        settings.Name = "IdTrainingsCource";
        settings.CallbackRouteValues = new { Controller = "TC", Action = "TrainingsSchedulesEditCoursesPartial" };
        settings.Properties.ValueType = typeof(int);
        settings.Properties.TextField = "Name";
        settings.Width = 604;
        settings.Properties.ValueField = "IdTrainingsCourse";
        settings.Properties.EnableCallbackMode = true;
        settings.Properties.ClientSideEvents.SelectedIndexChanged = "function(s, e) { IdTrainingsTrainer.PerformCallback();  }";
    }).BindList(coursesCol.GetFullDefinedCoursesByCourseType(Model.IdTrainingCoursesType).OrderBy(p => p.Name)).Bind(Model.IdTrainingsCource).GetHtml();
    //}).BindList(DB.GetFullDefinedCoursesByCourseType(Model.IdTrainingCoursesType).OrderBy(p => p.Name)).Bind(Model.IdTrainingsCource).GetHtml();
}
%>

